Setup

Setting up a virtual environment

Let's create a virtual environment. Using a virtual environment allows you to manage dependencies for different projects separately, avoiding conflicts between package versions.

In the terminal of your Cloud IDE, ensure that you are in the path /home/project, then run the following commands to create a Python virtual environment.

  1. 1
  2. 2
  3. 3
  1. pip install virtualenv
  2. virtualenv my_env # create a virtual environment named my_env
  3. source my_env/bin/activate # activate my_env

Installing necessary libraries

To ensure a seamless execution of our scripts, and considering that certain functions within these scripts rely on external libraries, it's essential to install some prerequisite libraries before you begin. For this project, the key libraries you will need are Gradio for creating user-friendly web interfaces and IBM Watsonx AI for leveraging advanced LLM model from IBM watsonx's API.

Here's how to install these packages (still from your terminal):

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  1. # installing necessary pacakges in my_env
  2. python3.11 -m pip install \
  3. gradio==4.44.0 \
  4. ibm-watsonx-ai==1.1.2 \
  5. langchain==0.2.11 \
  6. langchain-community==0.2.10 \
  7. langchain-ibm==0.1.11

Now, the environment is ready to create Python files.